import java.util.HashSet;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: dings
 * Date: 2024-07-06
 * Time: 12:07
 */
public class Test {
    public static void main(String[] args) {
        Student student1 = new Student("zhangsan",18);
        Student student2 = new Student("lisi",19);
        Student student3 = new Student("wangwu",20);
        Student student4 = new Student("zhangsan",18);

        HashSet<Student> hashSet = new HashSet<>();

        System.out.println(hashSet.add(student1));//true
        System.out.println(hashSet.add(student2));//true
        System.out.println(hashSet.add(student3));//true
        System.out.println(hashSet.add(student4));//false

        System.out.println(hashSet);
    }
}
